<script setup>
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
function goBack() {
    router.back()
}

const newFormRef = ref()
const newForm = reactive({
    name: '',
})
const formRules = reactive({
    name: [
        {
            required: true,
            message: '请输入名称',
        },
    ],
    shili: [
        {
            required: true,
            message: '请输入实例',
        },
    ],
    accessKey: [
        {
            required: true,
            message: '请输入accessKey',
        },
    ],
    accessSecret: [
        {
            required: true,
            message: '请输入accessSecret',
        },
    ],
    address: [
        {
            required: true,
            message: '请选择服务地址',
        },
    ],
})
function submitAction() {
    newFormRef.value.validate((valid, fields) => {
        if (valid) {
            console.log('submit!')
        } else {
            console.log('error submit!', fields)
        }
    })
}
</script>
<template>
    <el-page-header @back="goBack">
        <template #content>
            <span>新增阿里云 </span>
        </template>
    </el-page-header>
    <div class="white-box d-flex-1 mt-10">
        <el-row :gutter="50">
            <el-col :span="16">
                <el-form
                    ref="newFormRef"
                    :model="newForm"
                    label-width="80px"
                    :rules="formRules"
                    label-position="top"
                >
                    <el-form-item label="名称" prop="name">
                        <el-input v-model="newForm.name" placeholder="请输入" />
                    </el-form-item>
                    <el-form-item label="服务地址" prop="address">
                        <el-select
                            v-model="newForm.address"
                            placeholder="请选择"
                            class="full"
                        >
                            <el-option label="服务地址1" value="1" />
                            <el-option label="服务地址2" value="2" />
                        </el-select>
                    </el-form-item>
                    <el-form-item label="实例" prop="shili">
                        <el-input
                            v-model="newForm.shili"
                            placeholder="请输入"
                        />
                    </el-form-item>
                    <el-form-item label="accessKey" prop="accessKey">
                        <el-input
                            v-model="newForm.accessKey"
                            placeholder="请输入"
                        />
                    </el-form-item>
                    <el-form-item label="accessSecret" prop="accessSecret">
                        <el-input
                            v-model="newForm.accessSecret"
                            placeholder="请输入"
                        />
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="submitAction">
                            保存
                        </el-button>
                    </el-form-item>
                </el-form>
            </el-col>
            <el-col :span="8" class="article">
                <div class="fw-b">1、概述</div>
                <p>
                    概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述概述
                </p>
                <div class="fw-b">2、概述</div>
                <p>概述概述概述概述概述概述</p>
                <div class="fw-b">3、概述</div>
                <p>概述概述概述概述概述概述</p>
                <div class="fw-b">4、概述</div>
                <p>概述概述概述概述概述概述</p>
            </el-col>
        </el-row>
    </div>
</template>
<style lang="scss" scoped>
.article {
    line-height: 1.8;
    color: #666;
}
</style>
